package com.ft.oa.web.check;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ft.oa.domain.check.Detail;
import com.ft.oa.domain.check.ExecProjectExamine;
import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.service.check.ExecProjectExamineService;
import com.ft.oa.web.check.rq.ExecProjectExaminePage;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 项目验收接口管理
 */
@RestController
@RequestMapping("/epe")
public class ExecProjectExamineController {

    @Resource
    private ExecProjectExamineService execProjectExamineService;


    /**
     * 添加项目验收信息
     * @param execProjectExamine
     * @return
     */
    @PostMapping("/add")
    public ApiResult add(@RequestBody ExecProjectExamine execProjectExamine ){

        execProjectExamineService.add(execProjectExamine);
        return ApiResult.simpleSuccess();
    }

    /**
     * 修改项目验收信息
     * @param execProjectExamine
     * @return
     */
    @PostMapping("/update")
    public ApiResult update(@RequestBody ExecProjectExamine execProjectExamine){
        execProjectExamineService.update(execProjectExamine);
        return ApiResult.simpleSuccess();
    }

    /**
     * 删除项目验收信息
     * @param id
     * @return
     */
    @GetMapping("/del")
    public ApiResult del(@RequestParam Long id){
        execProjectExamineService.del(id);
        return ApiResult.simpleSuccess();
    }

    /**
     * 分页展示项目验收信息
     * @param execProjectExaminePage
     * @return
     */
    @PostMapping("/list")
    public ApiResult list(@RequestBody ExecProjectExaminePage execProjectExaminePage){
        Page<ExecProjectExamine> list = execProjectExamineService.list(execProjectExaminePage);
        return ApiResult.successWithData(list);
    }

    /**
     * 根据id查询项目验收详情
     * @param id
     * @return
     */
    @GetMapping("/select")
    public ApiResult select(@RequestParam Long id){
        ExecProjectExamine detail = execProjectExamineService.selectById(id);
        return ApiResult.successWithData(detail);
    }
}
